﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace RTS_RPG
{
    public class Overworld_TextureManager
    {
        public static short OVERWORLD_CHARACTER_SIZE    = 20;
        public static short HALF_CHARACTER_SIZE         = 10;

        public static short TOWN_SPRITE_SIZE    = 60;
        public static short HALF_TOWN_SIZE = 30;

        #region TEXTURE_SECTION
        /*********************/
        public Texture2D character_main         { get; private set; }
        public Texture2D town_sprite            { get; private set; }
        public Texture2D unit_default_image     { get; private set; }
        public Texture2D unit_default_attack    { get; private set; }
        public Texture2D unit_default_avatar    { get; private set; }
        public Texture2D keys_up                { get; private set; }
        public Texture2D keys_down              { get; private set; }
        public Texture2D keys_shift             { get; private set; }
        public Texture2D keys_ctrl              { get; private set; }
        public Texture2D keys_space             { get; private set; }
        public Texture2D mouse                  { get; private set; }
        public Texture2D blankBoxSmall          { get; private set; }
        public Texture2D select_arrow           { get; private set; }
        /*********************/
        #endregion
        public SpriteFont font;
        public SpriteFont font2;

        public IServiceProvider services;
        public ContentManager overworld_textures;
        public ContentManager pause_menu_textures;
        public Overworld_TextureManager(IServiceProvider s)
        {
            services = s;
            font = null;
            font2 = null;

            character_main          = null;
            town_sprite             = null;

            select_arrow            = null;

            unit_default_image      = null;
            unit_default_attack     = null;
            unit_default_avatar     = null;
            keys_up                 = null;
            keys_down               = null;
            keys_shift              = null;
            keys_ctrl               = null;
            keys_space              = null;
            mouse                   = null;
            blankBoxSmall           = null;
        }

        public void LoadOverworldContent()
        {
            overworld_textures = new ContentManager(services);
            overworld_textures.RootDirectory = "Content";
            font                = overworld_textures.Load<SpriteFont>("Shared/Fonts/font1");
            font2               = overworld_textures.Load<SpriteFont>("Shared/Fonts/font2");

            character_main      = overworld_textures.Load<Texture2D>("Overworld/Overworld_Sprite");
            town_sprite         = overworld_textures.Load<Texture2D>("Overworld/Towns/Town");

            mouse               = overworld_textures.Load<Texture2D>("Shared/Mouse");
            unit_default_avatar = overworld_textures.Load<Texture2D>("Shared/Basic_Avatar");

            unit_default_image  = overworld_textures.Load<Texture2D>("Battle/Basic_Unit");
            blankBoxSmall       = overworld_textures.Load<Texture2D>("Battle/Select");
            keys_up             = overworld_textures.Load<Texture2D>("Battle/Keys/UpKey");
            keys_down           = overworld_textures.Load<Texture2D>("Battle/Keys/DownKey");
            keys_shift          = overworld_textures.Load<Texture2D>("Battle/Keys/ShiftKey");
            keys_ctrl           = overworld_textures.Load<Texture2D>("Battle/Keys/CtrlKey");
            keys_space          = overworld_textures.Load<Texture2D>("Battle/Keys/SpaceKey");
            blankBoxSmall       = overworld_textures.Load<Texture2D>("Battle/Select");
        }

        public void LoadPauseMenuContent()
        {
            pause_menu_textures = new ContentManager(services);
            pause_menu_textures.RootDirectory = "Content";

            select_arrow = pause_menu_textures.Load<Texture2D>("Overworld/Pause_Menu/Select_Arrow");
        }

        public void UnloadOverworldContent()
        {
            overworld_textures.Unload();
        }

        public void UnloadPauseMenuContent()
        {
            pause_menu_textures.Unload();
        }
    }
}
